<template>
   
      <el-menu
        :default-active="infotype"
        mode="horizontal"
        @select="setInfotype"
        class="menus" 
        background-color="rgb(48, 65, 86)"
        text-color="rgb(191, 203, 217)"
        active-text-color="#409eff"
        :router="true"
      >
        <el-menu-item :index="'/xm/iteration/view/overview?iterationId='+xmIteration.id">
          <template #title>
          <div class="flex items-center"
            style="max-width: 15em; font-weight: 600; font-size: 20px; color: #ff8c00" 
            :title="xmIteration.iterationName"
          >  &nbsp;<el-avatar class="top-icon"  style="background-color:#2ab453;width:45px;min-width: 45px;border: 2px solid silver;">迭代</el-avatar> 
          &nbsp;<el-text size="large" truncated type="success"><div style="font-weight: 600; font-size: 20px; color: #2ab453" >{{ xmIteration.iterationName }}</div></el-text> 
 
          </div> 
          </template>
        </el-menu-item>
        <el-menu-item :index="'/xm/iteration/view/menu/scope?iterationId='+xmIteration.id">
          <template #title><icon icon="fa-solid:stethoscope"/>范围</template>
        </el-menu-item>      
				<el-menu-item label="需求" :index="'/xm/iteration/view/menu?iterationId='+xmIteration.id">
					 <template #title><icon icon="fa:envira"/>需求</template> 
				</el-menu-item> 
        
        <el-menu-item :index="'/xm/iteration/view/task?iterationId='+xmIteration.id">
            <template #title><icon icon="ep:operation"/>任务</template>
          </el-menu-item> 
        <el-menu-item :index="'/xm/iteration/view/test/plan?iterationId='+xmIteration.id">
            <template #title><icon icon="fa:fire"/>测试</template>
          </el-menu-item>   

        <el-menu-item :index="'/xm/iteration/view/question?iterationId='+xmIteration.id">
          <template #title><icon icon="fa:bug"/>问题</template>
        </el-menu-item>
        <el-menu-item :index="'/xm/iteration/view/group?iterationId='+xmIteration.id">
          <template #title><icon icon="fa:sitemap"/>团队</template>
        </el-menu-item> 
        <el-menu-item :index="'/xm/pro/iteration/view/rpt?iterationId='+xmIteration.id">
          <template #title><icon icon="fa:bar-chart"/>效能</template>
        </el-menu-item>
        <el-sub-menu index="zhishi">
          <template #title><icon icon="fa:book"/>知识</template>
          <el-menu-item :index="'/xm/product/view/file?productId='+xmIteration.productId">
            <template #title><icon icon="ep:document"/>文档</template>
          </el-menu-item>
          <el-menu-item :index="'/xm/iteration/view/record?iterationId='+xmIteration.id">
            <template #title><icon icon="ep:edit"/>日志</template>
          </el-menu-item>
        </el-sub-menu> 
        <el-sub-menu index="gongshi">
          <template #title><icon icon="fa-solid:business-time"/>工时</template> 
          <el-menu-item :index="'/xm/iteration/view/workloadDay?iterationId='+xmIteration.id">
            <template #title
              ><icon icon="fa-solid:user-clock"/>每日工时</template
            >
          </el-menu-item>
          <el-menu-item :index="'/xm/pro/iteration/view/workloadMonth?iterationId='+xmIteration.id">
            <template #title
              ><icon icon="fa-solid:user-cog"/>每月工时</template
            >
          </el-menu-item>   
        </el-sub-menu>  
        
        <el-sub-menu index="shezhi">
          <template #title><icon icon="ep:setting"/>设置</template>
          <el-menu-item :index="'/xm/iteration/view/detail?iterationId='+xmIteration.id">
            <template #title><icon icon="ep:document"/>迭代详情</template>
          </el-menu-item>
          <el-menu-item :index="'/xm/iteration/view/menu/scope?iterationId='+xmIteration.id">
            <template #title><icon icon="fa-solid:stethoscope"/>配置需求范围</template>
          </el-menu-item>      
          <el-menu-item label="产品模块" :index="'/xm/iteration/view/func?iterationId='+xmIteration.id">
            <template #title><icon icon="ep:menu"/>产品模块</template> 
          </el-menu-item>   
        </el-sub-menu>
        <el-menu-item :index="'/'">
          <template #title><icon icon="fa:home"/></template>
        </el-menu-item>
        <el-menu-item>
           <Screenfull class="custom-hover" color="var(--top-header-text-color)"/> 
        </el-menu-item> 
      </el-menu> 
  
</template>

<script> 
 
 
import { Screenfull } from '@/layout/components/Screenfull'
import { mapState } from 'pinia'
import { useUserStore } from '@/store/modules/user'
import { useXmStore } from '@/store/modules/xm'

export default {
  props: ["visible"],
  computed: {
    ...mapState(useUserStore,["userInfo", "roles"]),
    ...mapState(useXmStore,["xmIteration"]),
  },
  watch: {
    $route:{
      handler(newVal,oldValu){ 
        this.infotype=newVal.fullPath 
      },
      deep:true,
      immediate:true,
    }
  },
  data() {
    return { 
      infotype:'',  
    };
  }, //end data
  methods: {    
    setInfotype(infotype) {  
        this.infotype = infotype;  
    },   
     
  }, //end methods
  components: {
    Screenfull
    //在下面添加其它组件
  }, 
  mounted() {   
    this.infotype=this.$route.fullPath
  },
};
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
.menus {
  .el-menu-item {  
    padding-left: 10px !important; 
    padding-right: 10px !important; 
  }
}
.menus {
  .el-sub-menu{ 
    width:110px; 
  }
}
/* 超过宽度则用...代替 */
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.step-btn{
	margin-left:0px;margin-bottom: 5px;
}
</style>
